package pers.xuehongyan.useat.server.enity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

/**
 * @author xuehongyan
 */
@Data
@TableName("user")
public class User {
    @TableId(value = "id", type = IdType.AUTO)
    Integer id;

    @TableField("name")
    String name;

    @TableField("password")
    String password;

    @TableField(value = "seat_id", insertStrategy = FieldStrategy.IGNORED, updateStrategy = FieldStrategy.IGNORED)
    Integer seatId;

    @TableField("balance")
    Integer balance;

    private User() {
        this.seatId = null;
        this.balance = 0;
    }

    public User(String name, String password) {
        this();
        this.name = name;
        this.password = password;
    }

    public boolean isRenting() {
        return seatId != null;
    }
}
